from selenium import webdriver
import time

# 定义扣扣接口
info = {
    "deviceName": "emulator-5554",
    "platformName": "Android",
    "platformVersion": "7.1.2",
    "appPackage": "com.tencent.mobileqq",
    "appActivity": ".activity.LoginActivity",
    "onRest": True
}
# 远程连接
driver = webdriver.Remote("http://localhost:4723/wd/hub", info)
# 设置隐式等待 给find_element提供时间
driver.implicitly_wait(20)
# 元素的定位与操作
driver.find_element_by_id("com.tencent.mobileqq:id/dialogRightBtn").click()
driver.find_element_by_id("com.tencent.mobileqq:id/btn_login").click()
driver.find_element_by_id("com.tencent.mobileqq:id/t3p").click()
driver.find_element_by_id("com.tencent.mobileqq:id/sir").click()
driver.find_element_by_xpath("//android.widget.EditText[@content-desc=\"请输入QQ号码或手机号或QID或邮箱\"]").send_keys(
    '1718932352')
driver.find_element_by_id("com.tencent.mobileqq:id/tsn").send_keys('sai0415.0')
driver.find_element_by_id("com.tencent.mobileqq:id/sif").click()
driver.quit()
